package com.xxgc.ssm.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * 用来对接口文档进行配置
 */
@Configuration
@EnableSwagger2
public class SwaggerConfig {
    @Bean
    public Docket docket(){
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .enable(true)//框架的开关
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.xxgc.ssm"))
                .paths(PathSelectors.any())
                .build();
    }

    //用于接口文档的一些配置
    public ApiInfo apiInfo(){
        return new ApiInfoBuilder()
                .title("咕咕外面平台接口文档")
                .description("咕咕外面平台的描述")
                .contact(new Contact("公司名称","域名","邮箱"))
                .version("V0.0.3")
                .build();
    }

}
